package com.example.systemend.controller;

import com.example.systemend.pojo.App;
import com.example.systemend.pojo.Goods;
import com.example.systemend.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author 权哥
 * @version 1.0
 * @date 2022/6/5 13:39
 */
@RestController
public class GoodsControllor {

    @Autowired
    GoodsService goodsService;
    //1.库存管理
    @GetMapping("/inventory")
    public List<Goods> getInventory(){
        return goodsService.listinventory();
    }
    //2.货物添加
    @RequestMapping(value = "/purchase_add",method = RequestMethod.POST)
    public void purchase(@RequestBody Map map)  {
        goodsService.purchase_add(map);
    }
    //3.进货订单列表
    @RequestMapping("/purchase")
    public List<Goods> getPurchase(){
        return goodsService.select_purchase();
    }
    //4.出货订单列表
    @RequestMapping("/shipment")
    public List<Goods> getShipment(){
        return goodsService.select_shipment();
    }
    //5.（主页）
    @RequestMapping("/app")
    public List<App> sum(){
        
        return goodsService.getResult();
    }
    //6.出货订单添加
    @RequestMapping(value = "/shipment_add",method = RequestMethod.POST)
    public void shipment(@RequestBody Map map)  {
        goodsService.shipment_add(map);
    }
    //7.库存查询
    @RequestMapping(value = "/select_inventory",method = RequestMethod.POST)
    public List<Goods> select_inventory(@RequestBody Map map)  {
        return goodsService.getInventory(map);
    }
}
